package com.qf.fronted.controller;

import com.qf.fronted.domain.Goods;
import com.qf.fronted.service.IGoodService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 1.主要的作用是当用户到达购物车页面的时候, 要展示商品的信息。
 * 根据商品的id, 查询商品的信息, 商品的id形式为：1001,1002,1003
 */
@RestController
@RequestMapping(value = "/cart", name = "FrontedCartServlet")
@CrossOrigin("*")
public class CartController {

    private IGoodService goodServiceImpl;

    public CartController(IGoodService goodServiceImpl) {
        this.goodServiceImpl = goodServiceImpl;
    }

    @PostMapping
    public List<Goods> getGoodsByIds(Integer[] ids) {
            return goodServiceImpl.getGoodsByIds(ids);
    }
}
